/*
copy this file to your ~HOME/.tracker/ folder 
*/

import org.eclipse.swt._
import org.eclipse.swt.graphics.Font
import tracker.ui.Main._
import tracker.model._
import bamboo.util._
import bamboo.util.DateMath._

def help[T](klass:  Class[T]) {
        klass.getFields.foreach(println(_))
        klass.getMethods.foreach(println(_))
}

def help(o: AnyRef) {
        help(o.getClass)
}

def printActivity(a: Activity) {
        import java.text.DateFormat
        val f = DateFormat.getDateInstance(DateFormat.SHORT)
        println("" + f.format(a.started) + "\t" + a + "\t" + a.notes)
}

def workedToday = system.activities.from(Dates.today).totalTime

def lastWeek = system.activities.from(Dates.today - TimeSpan.hours(7*24))

def workedLastWeek = lastWeek.totalTime

interpreter.setFont(new Font(display, "Lucida Console", 12, SWT.NORMAL))

interpreter.import_("bamboo.util._")
interpreter.import_("bamboo.util.DateMath._")
interpreter.import_("tracker.model._")


/* menu extensions 
onShow(menu) {
        separator(menu)
        menuItem(menu, "Testing...") {
                prompt("Test what?")
        }
}
*/